using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace OpenComposite.Base
{
	[ToolboxBitmap(typeof(ComboBox))]
	[DefaultEvent("ButtonClick")]
	/// <summary>
	/// Summary description for ucDlgSelComboBox.
	/// </summary>
	public class ucDlgSelComboBox : System.Windows.Forms.UserControl
	{
		[Category("Action")]
		public event System.EventHandler ButtonClick;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox textBox1;
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public ucDlgSelComboBox()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			textBox1.Text = "";

		}

		[Browsable(true)]
		[DefaultValue("")]
		public new string Text {
			get { return textBox1.Text; }
			set { textBox1.Text = value; }
		}

		[Category("Behavior")]
		[DefaultValue(true)]
		public bool ReadOnly {
			get { return textBox1.ReadOnly; }
			set {
				textBox1.ReadOnly = value;
//				if ( textBox1.ReadOnly ) {
//					textBox1.BackColor = panel1.BackColor = Color.FromKnownColor( KnownColor.Control );
//				} else {
					textBox1.BackColor = panel1.BackColor = Color.FromKnownColor( KnownColor.Window );
//				}
			}
		}



		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		protected void OnButtonClick() {
			if ( this.ButtonClick != null ) {
				this.ButtonClick(button1, new System.EventArgs());
			}
		}

		#region Component Designer generated code
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ucDlgSelComboBox));
			this.panel1 = new System.Windows.Forms.Panel();
			this.button1 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.panel1.SuspendLayout();
			this.SuspendLayout();
			// 
			// panel1
			// 
			this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.panel1.Controls.Add(this.button1);
			this.panel1.Controls.Add(this.textBox1);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel1.Location = new System.Drawing.Point(0, 0);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(112, 21);
			this.panel1.TabIndex = 1;
			// 
			// button1
			// 
			this.button1.BackColor = System.Drawing.SystemColors.Control;
			this.button1.Dock = System.Windows.Forms.DockStyle.Right;
			this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
			this.button1.Location = new System.Drawing.Point(92, 0);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(18, 19);
			this.button1.TabIndex = 1;
			this.button1.Text = "...";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// textBox1
			// 
			this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.textBox1.BackColor = System.Drawing.SystemColors.Window;
			this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.textBox1.Location = new System.Drawing.Point(2, 2);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(87, 13);
			this.textBox1.TabIndex = 0;
			this.textBox1.Text = "textBox1";
			// 
			// ucDlgSelComboBox
			// 
			this.BackColor = System.Drawing.SystemColors.Window;
			this.Controls.Add(this.panel1);
			this.Name = "ucDlgSelComboBox";
			this.Size = new System.Drawing.Size(112, 21);
			this.panel1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion



		private void button1_Click(object sender, System.EventArgs e) {
			OnButtonClick();
		}

	}
}
